//
//  mySettingChangPhontNumVC.swift
//  DingDongZP
//
//  Created by 三秒文化 on 16/4/13.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

import UIKit

class mySettingChangPhontNumVC: LDBaseCustomizeVC {
    
    var titlelab:UILabel?
    var phonelab:UILabel?
    var secretfield:baseInputSecretField?
    var conformbtn:UIButton?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setDefaultContent()
        updateContent()//请求后的操作
    }
    func setDefaultContent() {
        
        view.backgroundColor = LDGolbalColor.BgGoundGray
        titlelab = UILabel.setDetailsLab("为了保证帐号安全,请输入密码", fontSize: 14, titleColor: LDFontColor.LightGray, Alignment: .Center)
        phonelab = UILabel.setDetailsLab("", fontSize: 24, titleColor: LDFontColor.DeepGray, Alignment: .Center)
        secretfield = baseInputSecretField()
        secretfield?.textField?.font = LDFont.Font15
        secretfield?.textField?.placeholder = "密 码"
        
        conformbtn = UIButton.setDetailsBtn("确 定", picName: nil, btnBackColor: LDGolbalColor.Green, titleColor: LDFontColor.White)
        conformbtn?.titleLabel?.font = LDFont.Font18
        
        
        view.addSubview(titlelab!)
        view.addSubview(phonelab!)
        view.addSubview(secretfield!)
        view.addSubview(conformbtn!)
        
        
        titlelab?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(40)
            make.left.right.equalTo(0)
            make.height.equalTo(20)
        })
        phonelab?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo((titlelab?.snp_bottom)!).offset(LDMargin_H*2)
            make.height.equalTo(30)
            make.centerX.equalTo(titlelab!)
        })
        secretfield?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo((phonelab?.snp_bottom)!).offset(LDMargin_H*6)
            make.left.equalTo(LDMargin_H*4)
            make.right.equalTo(-LDMargin_H*4)
            make.height.equalTo(45)
        })
        conformbtn?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo((secretfield?.snp_bottom)!).offset(LDMargin_H*6*2)
            make.size.left.right.equalTo(secretfield!)
        })
    }
    //刷新数据后
    func updateContent() {
        let phoneStr = LDUserInfo.sharedInstance.userPhoneNo
        let attr = NSMutableAttributedString.init(string: phoneStr)
        let range = NSMakeRange(3, 4)
        attr.replaceCharactersInRange(range, withString: " XXXX ")
        phonelab?.attributedText = attr
    }

}
